package com.gitee.zhanyao.common.service.entity.system;

import com.gitee.zhanyao.common.service.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 用户
 */
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "sys_user")
public class SysUser extends BaseEntity implements Serializable {

    /**
     * 用户主键
     */
    private String id;
    /**
     * 昵称
     */
    private String nickname;
    /**
     * 密码
     */
    private String password;
    /**
     * 姓名
     */
    private String username;
    /**
     * 手机号
     */
    private String mobile;
    /**
     * 电子邮箱
     */
    private String email;
    /**
     * 登录时间
     */
    private LocalDateTime loginTime;
    /**
     * 上次登录时间
     */
    private LocalDateTime lastLoginTime;
    /**
     * 登录次数
     */
    private Long count;
    /**
     * 失败尝试次数
     */
    private Integer failLoginCount;
    /**
     * 是否锁定
     */
    private Boolean isLock;
    /**
     * 系统编码
     */
    private String sysCode;

    /**
     * 用户帐号
     */
    @OneToMany(mappedBy = "sysUser", fetch = FetchType.LAZY)
    private List<SysUserAccount> sysUserAccounts;

}
